package com.DHH.Entity.Base;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 实体类BaseUser
 * 数据表base_tb_user
 * 用户表
 * 2017-8-3 12:33:07
 * @author Administrator
 *
 */
@Table(name = "base_tb_user")
public class BaseUser  implements Serializable {

	//
	@Id
	@GeneratedValue(generator = "JDBC")
	private Integer id;
	//身份
	@NotNull(message = "账号不能为空")
	@Length(max = 32, message = "身份长度为0-32个字符")
	private String identity;
	//令牌
	@NotNull(message = "令牌不能为空")
	@Length(max = 16, min = 6, message = "密码长度为6-16个字符")
	private String token;
	//最后一次登录时间
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone ="GMT+8:00" )
	private Date visitTime;
	//
	private String cookieKey;
	//锁定
	private Integer islock;
	//注册时间
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone ="GMT+8:00" )
	private Date registerTime;
	//盐

	private String salt;
	//是否在线
	private Integer isOnline;
	//
	@NotNull(message = "不能为空")
	@Length(max = 11, min = 11, message = "联系电话长度为11个字符")
	private String phone;
	//
	@NotNull(message = "不能为空")
	@Length(max = 6, min = 4, message = "用户名长度为4-6个字符")
	private String username;
	private String email;
	private String userSource;//用户来源
	@Transient
	private BaseUserInfo baseUserInfo;
	@Transient
	private Set<BaseRole> baseRoleSet;
	@Transient
	private Set<BaseMenu> baseMenuSet;
	public BaseUser(){

	}

	public void setId(Integer id){
		this.id=id;
	}

	public Integer getId(){
		return this.id;
	}
	public void setIdentity(String identity){
		this.identity=identity;
	}

	public String getIdentity(){
		return this.identity;
	}
	public void setToken(String token){
		this.token=token;
	}

	public String getToken(){
		return this.token;
	}
	public void setVisitTime(Date visitTime){
		this.visitTime=visitTime;
	}

	public Date getVisitTime(){
		return this.visitTime;
	}
	public void setCookieKey(String cookieKey){
		this.cookieKey=cookieKey;
	}

	public String getCookieKey(){
		return this.cookieKey;
	}
	public void setIslock(Integer islock){
		this.islock=islock;
	}

	public Integer getIslock(){
		return this.islock;
	}
	public void setRegisterTime(Date registerTime){
		this.registerTime=registerTime;
	}

	public Date getRegisterTime(){
		return this.registerTime;
	}
	public void setSalt(String salt){
		this.salt=salt;
	}

	public String getSalt(){
		return this.salt;
	}
	public void setIsOnline(Integer isOnline){
		this.isOnline=isOnline;
	}

	public Integer getIsOnline(){
		return this.isOnline;
	}
	public void setPhone(String phone){
		this.phone=phone;
	}

	public String getPhone(){
		return this.phone;
	}
	public void setUsername(String username){
		this.username=username;
	}

	public String getUsername(){
		return this.username;
	}
	public void setEmail(String email){
		this.email=email;
	}

	public String getEmail(){
		return this.email;
	}

	public BaseUserInfo getBaseUserInfo() {
		return baseUserInfo;
	}

	public void setBaseUserInfo(BaseUserInfo baseUserInfo) {
		this.baseUserInfo = baseUserInfo;
	}

	public Set<BaseRole> getBaseRoleSet() {
		return baseRoleSet;
	}

	public void setBaseRoleSet(Set<BaseRole> baseRoleSet) {
		this.baseRoleSet = baseRoleSet;
	}

	public Set<BaseMenu> getBaseMenuSet() {
		return baseMenuSet;
	}

	public void setBaseMenuSet(Set<BaseMenu> baseMenuSet) {
		this.baseMenuSet = baseMenuSet;
	}

	@Override
	public String toString() {
		return "BaseUser{" +
				"id=" + id +
				", identity='" + identity + '\'' +
				", token='" + token + '\'' +
				", visitTime=" + visitTime +
				", cookieKey='" + cookieKey + '\'' +
				", islock=" + islock +
				", registerTime=" + registerTime +
				", salt='" + salt + '\'' +
				", isOnline=" + isOnline +
				", phone='" + phone + '\'' +
				", username='" + username + '\'' +
				", email='" + email + '\'' +
				", baseUserInfo=" + baseUserInfo +
				", baseRoleSet=" + baseRoleSet +
				", baseMenuSet=" + baseMenuSet +
				'}';
	}

	public String getUserSource() {
		return userSource;
	}

	public void setUserSource(String userSource) {
		this.userSource = userSource;
	}
}
